//
//  SCWarmWishCell.m
//  Mutal
//
//  Created by TonyStart on 16/10/22.
//  Copyright © 2016年 com.wx. All rights reserved.
//

#import "SCWarmWishCell.h"
#import <UIImageView+WebCache.h>
#import "NSString+SCTimeConvert.h"
#import "SCWishCommentViewModel.h"
@interface SCWarmWishCell()
@property (weak, nonatomic) IBOutlet UIImageView *picImage;
@property (weak, nonatomic) IBOutlet UILabel *userNameLabel;
@property (weak, nonatomic) IBOutlet UILabel *addTimeLabel;
@property (weak, nonatomic) IBOutlet UILabel *replyNum;
@property (weak, nonatomic) IBOutlet UILabel *titLabel;
@property (weak, nonatomic) IBOutlet UILabel *contentLabel;

@end

@implementation SCWarmWishCell

- (void)awakeFromNib {
    [super awakeFromNib];
    
}

-(void)setWishModel:(SCWishModel *)wishModel{
    _wishModel = wishModel;
    if(_wishModel){
        [self setupWishContent];
    }

}

-(void)setupWishContent{
    NSString *picUrl = [NSString stringWithFormat:@"http://www.scxxhs.com/huzhu%@",self.wishModel.avatar];
    
    [self.picImage sd_setImageWithPreviousCachedImageWithURL:[NSURL URLWithString:picUrl] placeholderImage:[UIImage imageNamed:@"默认头像"] options:SDWebImageRefreshCached progress:^(NSInteger receivedSize, NSInteger expectedSize) {
        
    } completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) {
        
    }];
    
    self.userNameLabel.text = self.wishModel.user_nicename;
    
    self.titLabel.text = self.wishModel.wish_title;
    
    self.addTimeLabel.text = [NSString stringWithFormat:@"上线时间 %@",[NSString getShowDateWithTime:self.wishModel.wish_add_time]] ;
    
    self.contentLabel.text = self.wishModel.wish_desc;
    SCWishCommentViewModel *wishCommentViewModel = [[SCWishCommentViewModel alloc] init];
    
    [wishCommentViewModel requestWishCommentWithPostID:self.wishModel.wish_id finish:^(NSInteger num) {
        self.replyNum.text = [NSString stringWithFormat:@"%ld",num];
    }];
//    self.replyNum = self.wishModel.


 
}
@end
